﻿<!DOCTYPE html>
<html lang="zh">

<head resource>
    <meta charset="utf-8">
    <include file="../inc/meta.inc" />
    <title>友情链接的分类</title>
</head>

<body>
    <div id="vapp" v-cloak>
        <div class="toolsbar">
            <btngroup show="新增,修改,删除" ref='btngroup' @delete="deleteData" path="SortModify" width="640" height="480"
                :selects='selects' idkey='Ls_Id' table="datatables"></btngroup>
            <query_panel :model="form" :loading="loading" @search="handleCurrentChange(1)">
                <el-form-item label="">
                    <el-input v-model="form.search" clearable placeholder="分类名称" style="width:100px"
                        @clear="handleCurrentChange(1)"></el-input>
                </el-form-item>
            </query_panel>
        </div>

        <el-table ref="datatables" :data="datas" tooltip-effect="dark" style="width: 100%" v-loading="loading"
            @selection-change="val=>selects=val"
            :row-class-name="data=>{return data.row.Ls_IsUse ? 'enable' : 'disabled';}"
            @row-dblclick="(row, column, event)=>$refs.btngroup.modify(row[$refs.btngroup.idkey])" row-key="Ls_Id"
            draggable>
            <el-table-column type="selection" width="35" show-overflow-tooltip>
            </el-table-column>
            <el-table-column type="index" width="50" align="center">
                <template slot-scope="scope">
                    <span>{{(form.index - 1) * form.size + scope.$index + 1}}</span>
                </template>
            </el-table-column>
            <el-table-column label="ID" show-overflow-tooltip width="60">
                <template slot-scope="scope">
                    {{scope.row.Ls_Id}}
                </template>
            </el-table-column>
            <el-table-column label="分类名称" min-width="200">
                <template slot-scope="scope">
                    <span v-html="showsearch(scope.row.Ls_Name,form.search)" class="draghandle large"></span>
                    <links_count :sort="scope.row" title="链接数："></links_count>
                </template>
            </el-table-column>
            <el-table-column label="提示" show-overflow-tooltip>
                <template slot-scope="scope">
                    {{scope.row.Ls_Tootip}}
                </template>
            </el-table-column>
            <el-table-column label="图片" width="80" align="center">
                <template slot="header" slot-scope="scope">
                    <el-tooltip content="该分类下的链接，在前端页面以图片形式展现" placement="bottom" effect="light">
                        <help>图片</help>
                    </el-tooltip>

                </template>
                <template slot-scope="scope">
                    <icon v-if="scope.row.Ls_IsImg">&#xe628</icon>
                </template>
            </el-table-column>
            <el-table-column label="文字" width="80" align="center">
                <template slot="header" slot-scope="scope">

                    <el-tooltip content="该分类下的链接，在前端页面显示文字链接" placement="bottom" effect="light">
                        <help>文字</help>
                    </el-tooltip>
                </template>
                <template slot-scope="scope">
                    <icon v-if="scope.row.Ls_IsText">&#xa029</icon>
                </template>
            </el-table-column>
            <el-table-column label="启用" width="100">
                <template slot="header" slot-scope="scope">
                    <el-tooltip content="禁用后不仅无法在前端页面展示，在编辑链接时，也无法选择该分类" placement="bottom" effect="light">
                        <help>启用</help>
                    </el-tooltip>
                </template>
                <template slot-scope="scope">
                    <span class="el-icon-loading" v-show="loadingid==scope.row.Ls_Id"></span>
                    <div>
                        <el-switch v-model="scope.row.Ls_IsUse" @change="changeState(scope.row)" active-color="#13ce66"
                            inactive-color="#ff4949" v-show="loadingid!=scope.row.Ls_Id"
                            :active-text="scope.row.Ls_IsUse ? '启用' : '禁用'">
                        </el-switch>
                    </div>
                </template>
            </el-table-column>

            <el-table-column label="显示" width="120">
                <template slot="header" slot-scope="scope">
                    <el-tooltip content="是否在前端页面展示" placement="bottom" effect="light">
                        <help>显示</help>
                    </el-tooltip>
                </template>
                <template slot-scope="scope">
                    <span class="el-icon-loading" v-show="loadingid==scope.row.Ls_Id"></span>
                    <div>
                        <el-switch v-model="scope.row.Ls_IsShow" @change="changeState(scope.row)"
                            v-show="loadingid!=scope.row.Ls_Id" :active-text="scope.row.Ls_IsShow ? '显示' : '隐藏'">
                        </el-switch>
                    </div>
                </template>
            </el-table-column>

            <el-table-column label="操作" show-overflow-tooltip width="120" fixed="right">

                <el-button-group slot-scope="scope">
                    <el-link type="primary" plain icon="el-icon-edit" @click='$refs.btngroup.modify(scope.row.Ls_Id)'>修改
                    </el-link>
                    <el-popconfirm confirm-button-text='是的' cancel-button-text='不用' icon="el-icon-info" icon-color="red"
                        title="确定删除吗？" @confirm="$refs.btngroup.delete(scope.row.Ls_Id,{})">
                        <el-link type="danger" plain icon="el-icon-delete" slot="reference">删除
                        </el-link>
                    </el-popconfirm>
                </el-button-group>
            </el-table-column>
        </el-table>


        <div id="pager-box">
            <el-pagination v-on:current-change="handleCurrentChange" :current-page="form.index" :page-sizes="[1]"
                :page-size="form.size" :pager-count="12" layout="total, prev, pager, next, jumper" :total="total">
            </el-pagination>
        </div>
    </div>
</body>

</html>